import { requestPost, requestGet } from "@/service/requestL";

// 保存密码
export function UpdatePwd(Pwd, PwdNew) {
    return requestPost({
        url: "/api/Sys/UpdatePwd",
        data: {
            Pwd: Pwd,
            PwdNew: PwdNew
        }
    });
}

// 获取菜单列表-根据用户
export function GetMenuList() {
    return requestPost({
        url: "/api/Sys/GetMenuList",
        data: {}
    });
}

// 登录
export function Login(username, password, verificationCode, id) {
    return requestPost({
        url: "/api/Login/Login",
        data: {
            AccountNo: username,
            Pwd: password,
            VerificationCode: verificationCode,
            Id: id
        }
    });
}
export function Captcha(data) {
    return requestPost({
        url: "/api/Login/Captcha",
        data: data,
        responseType: "blob"
    });
}

// 获取菜单列表-树结构
export function GetMenuTreeList(username, password) {
    return requestPost({
        url: "/api/Sys/GetMenuTreeList",
        data: {}
    });
}

// 保存菜单
export function SaveMenu(data) {
    return requestPost({
        url: "/api/Sys/SaveMenu",
        data: data
    });
}
// 删除菜单
export function DeleteMenu(id) {
    return requestPost({
        url: "/api/Sys/Delete",
        data: { id: id }
    });
}
// 启用禁用菜单
export function EnableMenu(id) {
    return requestPost({
        url: "/api/Sys/Enable",
        data: { id: id }
    });
}
// 获取角色列表
export function GetRoleList(data) {
    return requestPost({
        url: "/api/Sys/GetRoleList",
        data: data
    });
}
// 删除角色
export function DeleteRole(id) {
    return requestPost({
        url: "/api/Sys/DeleteRole",
        data: { id: id }
    });
}
// 保存角色
export function SaveRole(data) {
    return requestPost({
        url: "/api/Sys/SaveRole",
        data: data
    });
}

// 获取账号列表
export function GetAccountList(data) {
    return requestPost({
        url: "/api/Sys/GetAccountList",
        data: data
    });
}
//获取角色列表-全部
export function GetRoleListAll() {
    return requestPost({
        url: "/api/Sys/GetRoleListAll",
        data: {}
    });
}
// 删除账号
export function DeleteAccount(id) {
    return requestPost({
        url: "/api/Sys/DeleteAccount",
        data: { id: id }
    });
}
// 重置密码
export function ResetPassword(id) {
    return requestPost({
        url: "/api/Sys/ResetPassword",
        data: { id: id }
    });
}
//保存账号
export function SaveAccount(data) {
    return requestPost({
        url: "/api/Sys/SaveAccount",
        data: data
    });
}
//启用禁用账号
export function EnableAccount(id) {
    return requestPost({
        url: "/api/Sys/EnableAccount",
        data: { id: id }
    });
}
//获取用户 配置的角色列表
export function GetRoleListByUser(id) {
    return requestPost({
        url: "/api/Sys/GetRoleListByUser",
        data: { id: id }
    });
}
//获取菜单列表 权限关联
export function GetMenuPowerList(id) {
    return requestPost({
        url: "/api/Sys/GetMenuPowerList",
        data: { id: id }
    });
}

//获取角色权限
export function GetRolePower(id) {
    return requestPost({
        url: "/api/Sys/GetRolePower",
        data: { id: id }
    });
}
//保存权限
export function SaveRolePower(data) {
    return requestPost({
        url: "/api/Sys/SaveRolePower",
        data: data
    });
}
//保存权限
export function SaveRolePowerV3(data) {
    return requestPost({
        url: "/api/Sys/SaveRolePowerV3",
        data: data
    });
}
//获取登录日
export function GetLoginLogList(data) {
    return requestPost({
        url: "/api/Sys/GetLoginLogList",
        data: data
    });
}
//获取错误日志
export function GetErrorLogList(data) {
    return requestPost({
        url: "/api/Sys/GetErrorLogList",
        data: data
    });
}
//获取api日志
export function GetApiLogList(data) {
    return requestPost({
        url: "/api/Sys/GetApiLogList",
        data: data
    });
}
//获取需要生成前端代码 表集合
export function GetCodeCreateList() {
    return requestPost({
        url: "/api/Sys/GetCodeCreateList",
        data: {
            KeyWords: ""
        }
    });
}

//生成代码
export function CodeCreate(tablename) {
    return requestPost({
        url: "/api/Sys/CodeCreate",
        data: {
            KeyWords: tablename
        }
    });
}

export function GetPermissionListAll(data) {
    return requestPost({
        url: "/api/Sys/GetPermissionListAll",
        data: data
    });
}

export function SavePermission(data) {
    return requestPost({
        url: "/api/Sys/SavePermission",
        data: data
    });
}

export function DeletePermission(id) {
    return requestPost({
        url: "/api/Sys/DeletePermission",
        data: {
            id: id
        }
    });
}

export function GetOption() {
    return requestPost({
        url: "/api/Sys/GetOptions"
    });
}
